<!-- 解锁信息 -->
<template>
	<view class="newLock">
		<!-- 单条购买 -->
		<view class="adS" v-for="(item,index) of goodsList" :key="index">
			<view class="ad-publishPeople font14" >
				<view class="flex alignCenter">
					<view class="bold font16 txt">{{item.name}}</view>
					<view class="btn font12" @click="handlePay(1,item)">提交订单</view>
				</view>
			</view>
		</view>
		<!-- 已购点我 -->
		<view class="adS">
			<view class="ad-publishPeople font14" >
				<view class="flex alignCenter">
					<view class="bold font16 txt">已购点我</view>
					<view class="btn font12" @click="handlePay(2)">点我</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { queryGoodOfAdjustNotice} from "@/api/toolbox.js"
	export default {
		data() {
			return {
				goodsList: [],
				status: 2, //1、智慧调剂，2、最新调剂
				info: {},
			}
		},
		onLoad(options) {
			if(options?.items){
				this.info = JSON.parse(options.items);
			}
		},
		onShow(){
			this.userId = uni.getStorageSync('userId');
			this.getList();
			// this.getData();
		},
		methods: {
			getList(){
				queryGoodOfAdjustNotice().then(res=>{
					if(res.code == 100000){
						this.goodsList = res.data;
					}
				})
			},
			// 购买 type 1、单条/全部购买，2、已购
			handlePay(type=1,item=''){
				if(type == 1){
					let query = {
						type: item.id == '30'?8:9, //8、单独购，9、全部购
						money: item.price,
						id: item.id,
						params: this.info
					}
					// 新增成功找人数据成功后,判断是否委托找人.是则关联委托人id,否则继续往下执行
					uni.navigateTo({
						url: '/pages/order/order?query='+JSON.stringify(query)
					})
					return
				}
				//已购的跳转兑换页面
				uni.navigateTo({
					url: '/pages/toolbox/adjustReport/components/exchange'
				})
			},
		},
	}
</script>
<style>

</style>
<style lang="scss" scoped>
	page{
		background: rgba(235, 238, 239, 0.8);
	}
	.newLock{
		margin-top: 44rpx;
		.adS{
			height: 200rpx;
			margin: 0 40rpx 80rpx;
			text-align: center;
			.ad-publishPeople{
				background: #fff;
				// background: url("../static/lookBgn.png") no-repeat;
				// background-size: cover;
				// background-repeat: no-repeat;
				height: 200rpx;
				width: 100%;
				// border-radius: 16rpx;
				display: flex;
				align-items: center;
				margin: auto;
				>view{
					width: 100%;
					padding: 0 30rpx;
					justify-content: space-between;
				}
				.txt{
					max-width: 460rpx;
					margin: auto;
					font-size: 30px;
				}
				.btn{
					background: #FED534;
					color: #2E383E;
					width: 134rpx;
					height: 60rpx;
					border-radius: 40rpx;
					line-height: 60rpx;
					text-align: center;
				}
			}
			
			.ad-list{
				margin: 32rpx 0;
				height: 200rpx;
				background: #fff;
				// border-radius: 10rpx;
			}
		}
		
	}
</style>